<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Bayesian Network: bayesian/network/adjacency_matrix.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Bayesian Network
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_4922399365a46b010edf8e4eee2a5dfb.html">bayesian</a></li><li class="navelem"><a class="el" href="dir_56c81f943e16f382d13475f1c8bedad4.html">network</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">adjacency_matrix.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="adjacency__matrix_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef BAYESIAN_NETWORKS_NETWORK_ADJACENCY_MATRIX_HPP</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define BAYESIAN_NETWORKS_NETWORK_ADJACENCY_MATRIX_HPP</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span> <span class="comment">//find_if</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;list&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="component_8hpp.html">bayesian/network/component.hpp</a>&gt;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="traits_8hpp.html">bayesian/network/traits.hpp</a>&gt;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacebn.html">bn</a> {</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html">   22</a></span>&#160;<span class="keyword">class </span><a class="code" href="classbn_1_1adjacency__matrix.html">adjacency_matrix</a> {</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keyword">using</span> <a class="code" href="classbn_1_1adjacency__matrix.html">this_type</a> = <a class="code" href="classbn_1_1adjacency__matrix.html#a7e9b5530fa1be36f06d251e2117d543f">adjacency_matrix</a>;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    <span class="keyword">using</span> node_ptr = component::node_ptr;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <span class="keyword">using</span> arc_ptr = component::arc_ptr;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keyword">using</span> node_const_ptr = <a class="code" href="traits_8hpp.html#aa44fb0011435752a09a0f9b519f8d863">traits::add_const_shared_t&lt;component::node_ptr&gt;</a>;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <span class="keyword">using</span> arc_const_ptr = <a class="code" href="traits_8hpp.html#aa44fb0011435752a09a0f9b519f8d863">traits::add_const_shared_t&lt;component::arc_ptr&gt;</a>;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keyword">using</span> stored_node_type = std::list&lt;node_ptr&gt;;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    <span class="keyword">using</span> node_dictionary_type = std::unordered_map&lt;node_const_ptr, std::size_t&gt;;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="keyword">using</span> endpoint_dictionary_type =</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;        std::unordered_map&lt;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;        arc_const_ptr,</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;        std::pair&lt;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;        node_const_ptr,</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;        node_const_ptr&gt;&gt;;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <span class="keyword">using</span> adjacency_type = std::vector&lt;std::vector&lt;arc_ptr&gt;&gt;;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <a class="code" href="classbn_1_1adjacency__matrix.html#a7e9b5530fa1be36f06d251e2117d543f">adjacency_matrix</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <a class="code" href="classbn_1_1adjacency__matrix.html#a7e9b5530fa1be36f06d251e2117d543f">adjacency_matrix</a>(<a class="code" href="classbn_1_1adjacency__matrix.html">this_type</a> <span class="keyword">const</span>&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    <a class="code" href="classbn_1_1adjacency__matrix.html#a7e9b5530fa1be36f06d251e2117d543f">adjacency_matrix</a>(<a class="code" href="classbn_1_1adjacency__matrix.html">this_type</a>&amp;&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classbn_1_1adjacency__matrix.html#a2ff0a6c49658b14c4300b0ba7cc64ed4">~adjacency_matrix</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#ae1686c835506377c0965293cd5b9de8b">   56</a></span>&#160;    <a class="code" href="classbn_1_1adjacency__matrix.html">this_type</a>&amp; <a class="code" href="classbn_1_1adjacency__matrix.html#ae1686c835506377c0965293cd5b9de8b">operator=</a>(<a class="code" href="classbn_1_1adjacency__matrix.html">this_type</a> <span class="keyword">const</span>&amp; rhs)</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    {</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        *<span class="keyword">this</span> = <a class="code" href="classbn_1_1adjacency__matrix.html">adjacency_matrix</a>{ rhs };</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    }</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    this_type&amp; <a class="code" href="classbn_1_1adjacency__matrix.html#ae1686c835506377c0965293cd5b9de8b">operator=</a>(this_type&amp;&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#af3fe5bfab47465dadcb7e75811672e3d">   72</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1adjacency__matrix.html#af3fe5bfab47465dadcb7e75811672e3d">add_node</a>(node_ptr <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    {</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        std::size_t <span class="keyword">const</span> new_size = node_dic_.size() + 1;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        std::vector&lt;arc_ptr&gt; new_line(new_size);</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        stored_node_.push_back(node);</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        <span class="keywordflow">try</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        {</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            node_dic_[node] = new_size - 1;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            <span class="keywordflow">try</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            {</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                <span class="keywordflow">for</span>(<span class="keyword">auto</span>&amp; vector : matrix_)</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                    vector.resize(new_size);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;                matrix_.push_back(std::move(new_line));</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;            }</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;            <span class="keywordflow">catch</span> (std::exception <span class="keyword">const</span>&amp;)</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;            {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                <span class="keywordflow">for</span> (<span class="keyword">auto</span>&amp; vector : matrix_)</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;                    vector.resize(new_size - 1); <span class="comment">// No-throw guarantee</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;                node_dic_.erase(node);</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;                <span class="keywordflow">throw</span>;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            }</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        }</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <span class="keywordflow">catch</span>(std::exception <span class="keyword">const</span>&amp;)</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        {</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;            stored_node_.pop_back();</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;            <span class="keywordflow">throw</span>;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        }</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        <span class="keywordflow">return</span> node;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    }</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#aeffc84b00aa2eb0ad233e6fa9dd0ca76">  114</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__matrix.html#aeffc84b00aa2eb0ad233e6fa9dd0ca76">remove_node</a>(node_ptr <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    {</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        <span class="keyword">auto</span> it = std::find(stored_node_.crbegin(), stored_node_.crend(), node);</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="keywordflow">if</span> (it == stored_node_.crend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        node_dictionary_type backup_node_dic = node_dic_;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        adjacency_type backup_matrix = matrix_;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> remove_index = node_dic_[node];</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        <span class="keywordflow">try</span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        {</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;            matrix_.erase(matrix_.cbegin() + remove_index);</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;            <span class="keywordflow">for</span>(<span class="keyword">auto</span>&amp; vector : matrix_)</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;                vector.erase(vector.cbegin() + remove_index);</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;            <span class="keywordflow">try</span></div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;            {</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;                <span class="keywordflow">for</span>(<span class="keyword">auto</span>&amp; elem : node_dic_)</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;                {</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;                    <span class="keywordflow">if</span>(elem.second &gt; remove_index) --elem.second;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;                }</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;            }</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;            <span class="keywordflow">catch</span> (std::exception <span class="keyword">const</span>&amp;)</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            {</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;                node_dic_ = backup_node_dic;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;                <span class="keywordflow">throw</span>;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            }</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        }</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        <span class="keywordflow">catch</span>(std::exception <span class="keyword">const</span>&amp;)</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        {</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;            matrix_ = std::move(backup_matrix);</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;            <span class="keywordflow">throw</span>;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        }</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> it = endpoint_dic_.begin(); it != endpoint_dic_.end();)</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        {</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;            <span class="keywordflow">if</span> (it-&gt;second.first == node || it-&gt;second.second == node)</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;                it = endpoint_dic_.erase(it);</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;            <span class="keywordflow">else</span> ++it;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;        }</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        stored_node_.erase((++it).base());</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    }</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;</div><div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#abc28afe43d3613d68d12ef8130ddc46d">  167</a></span>&#160;    arc_ptr <a class="code" href="classbn_1_1adjacency__matrix.html#abc28afe43d3613d68d12ef8130ddc46d">add_arc</a>(arc_ptr <span class="keyword">const</span>&amp; arc, node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to)</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    {</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> from_index = node_dic_[from];</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> to_index = node_dic_[to];</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        <span class="keywordflow">if</span> (from_index &gt;= matrix_.size() || to_index &gt;= matrix_[from_index].size())</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;        {</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;            <span class="comment">//TODO:</span></div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;            <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;&quot;</span>);</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        }</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;        <span class="keyword">auto</span> endpoint = std::pair&lt;node_const_ptr, node_const_ptr&gt;(from, to);</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        endpoint_dic_[arc] = std::move(endpoint);</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        matrix_[from_index][to_index] = arc;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;        <span class="keywordflow">return</span> arc;</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    }</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;</div><div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#a831a7bfc2725c17ea1f92018d38b59a7">  190</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__matrix.html#a831a7bfc2725c17ea1f92018d38b59a7">remove_arc</a>(arc_ptr <span class="keyword">const</span>&amp; arc) noexcept</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    {</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;        <span class="keyword">auto</span> it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;        <span class="keywordflow">if</span> (it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classbn_1_1adjacency__matrix.html#a831a7bfc2725c17ea1f92018d38b59a7">remove_arc</a>(arc, it-&gt;second.first, it-&gt;second.second);</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    }</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;</div><div class="line"><a name="l00205"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#a7a0f7187014326001d03f733fe364c6a">  205</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__matrix.html#a7a0f7187014326001d03f733fe364c6a">remove_arc</a>(node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to) noexcept</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;    {</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        <span class="keyword">auto</span> endpoint_it = std::find_if(</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;            endpoint_dic_.cbegin(), endpoint_dic_.cend(),</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;            [&amp;from, &amp;to](<span class="keyword">auto</span> <span class="keyword">const</span>&amp; elem) {</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;            <span class="keywordflow">return</span> elem.second.first == from &amp;&amp; elem.second.second == to;</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;        });</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;        <span class="keywordflow">if</span> (endpoint_it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classbn_1_1adjacency__matrix.html#a831a7bfc2725c17ea1f92018d38b59a7">remove_arc</a>(std::const_pointer_cast&lt;component::arc&gt;(endpoint_it-&gt;first), from, to);</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    }</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;</div><div class="line"><a name="l00224"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#afdeafe65325ba05e9ad1c7f72d7ca1ac">  224</a></span>&#160;    arc_ptr <a class="code" href="classbn_1_1adjacency__matrix.html#afdeafe65325ba05e9ad1c7f72d7ca1ac">is_adjacent</a>(node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to)<span class="keyword"> const</span></div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> from_index = node_dic_.at(from);</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> to_index = node_dic_.at(to);</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;        <span class="keywordflow">if</span>(from_index &gt;= matrix_.size() || to_index &gt;= matrix_[from_index].size()) <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;        <span class="keywordflow">return</span> matrix_[from_index][to_index];</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;    }</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;</div><div class="line"><a name="l00242"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#a3197b094434e85848f3bdee9bb740080">  242</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classbn_1_1adjacency__matrix.html#a3197b094434e85848f3bdee9bb740080">is_connect</a>(node_ptr <span class="keyword">const</span>&amp; node, arc_ptr <span class="keyword">const</span>&amp; arc) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    {</div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;        <span class="keyword">auto</span> endpoint_it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;        <span class="keywordflow">if</span>(endpoint_it == endpoint_dic_.cend()) <span class="keywordflow">return</span> 0; <span class="comment">// Not registered</span></div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;        <span class="keywordflow">return</span> endpoint_it-&gt;second.first  == node ?  1 :</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;               endpoint_it-&gt;second.second == node ? -1 :</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;                                                     0 ;</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;    }</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;</div><div class="line"><a name="l00259"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#ad398cf36e8f27e219dee05fe9429a0d2">  259</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1adjacency__matrix.html#ad398cf36e8f27e219dee05fe9429a0d2">source</a>(arc_ptr <span class="keyword">const</span>&amp; arc) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    {</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;        <span class="keyword">auto</span> endpoint_it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;        <span class="keywordflow">if</span> (endpoint_it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">nullptr</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        <span class="keywordflow">return</span> std::const_pointer_cast&lt;<a class="code" href="classbn_1_1component_1_1node.html">component::node</a>&gt;(endpoint_it-&gt;second.first);</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    }</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;</div><div class="line"><a name="l00273"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#ad4f5c3ee06fd608989ada1fb77a43b4d">  273</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1adjacency__matrix.html#ad4f5c3ee06fd608989ada1fb77a43b4d">target</a>(arc_ptr <span class="keyword">const</span>&amp; arc) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    {</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;        <span class="keyword">auto</span> endpoint_it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        <span class="keywordflow">if</span> (endpoint_it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">nullptr</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;</div><div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;        <span class="keywordflow">return</span> std::const_pointer_cast&lt;<a class="code" href="classbn_1_1component_1_1node.html">component::node</a>&gt;(endpoint_it-&gt;second.second);</div><div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;    }</div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;</div><div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;</div><div class="line"><a name="l00287"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#aa92bafa3f9c3b22d08dee2095042ef0c">  287</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1adjacency__matrix.html#aa92bafa3f9c3b22d08dee2095042ef0c">parent_nodes</a>(node_ptr <span class="keyword">const</span>&amp; child)<span class="keyword"> const</span></div><div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> child_index = node_dic_.at(child);</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        std::vector&lt;node_ptr&gt; parents;</div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;        parents.reserve(stored_node_.size());</div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> it = stored_node_.cbegin(); it != stored_node_.cend(); ++it)</div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;        {</div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;            <span class="keyword">auto</span> <span class="keyword">const</span> it_index = node_dic_.at(*it);</div><div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;            <span class="keywordflow">if</span> (matrix_[it_index][child_index])</div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;                parents.push_back(*it);</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;        }</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;</div><div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;        parents.shrink_to_fit();</div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;        <span class="keywordflow">return</span> parents;</div><div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;    }</div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;</div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;</div><div class="line"><a name="l00311"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#a35ec62aed27f33404ff2188728070f3c">  311</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1adjacency__matrix.html#a35ec62aed27f33404ff2188728070f3c">child_nodes</a>(node_ptr <span class="keyword">const</span>&amp; parent)<span class="keyword"> const</span></div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> parent_index = node_dic_.at(parent);</div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;</div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;        std::vector&lt;node_ptr&gt; children;</div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;        children.reserve(stored_node_.size());</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;</div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> it = stored_node_.cbegin(); it != stored_node_.cend(); ++it)</div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;        {</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;            <span class="keyword">auto</span> <span class="keyword">const</span> it_index = node_dic_.at(*it);</div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;            <span class="keywordflow">if</span>(matrix_[parent_index][it_index])</div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;                children.push_back(*it);</div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;        }</div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;        children.shrink_to_fit();</div><div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;        <span class="keywordflow">return</span> children;</div><div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    }</div><div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;</div><div class="line"><a name="l00330"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#ae1067f195eaa0abc2ae0ff316d14d425">  330</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1adjacency__matrix.html#ae1067f195eaa0abc2ae0ff316d14d425">all_node</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;        <span class="keywordflow">return</span> std::vector&lt;node_ptr&gt;(stored_node_.cbegin(), stored_node_.cend());</div><div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    }</div><div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;</div><div class="line"><a name="l00336"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__matrix.html#a8663d697a4ebc12cec6f4a77dd5323bf">  336</a></span>&#160;    std::vector&lt;arc_ptr&gt; <a class="code" href="classbn_1_1adjacency__matrix.html#a8663d697a4ebc12cec6f4a77dd5323bf">all_arc</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;        std::vector&lt;arc_ptr&gt; arcs;</div><div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;        arcs.reserve(endpoint_dic_.size());</div><div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;</div><div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> <span class="keyword">const</span>&amp; endpoint : endpoint_dic_)</div><div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;            arcs.push_back(std::const_pointer_cast&lt;component::arc&gt;(endpoint.first));</div><div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;</div><div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;        arcs.shrink_to_fit();</div><div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;        <span class="keywordflow">return</span> arcs;</div><div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;    }</div><div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;</div><div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__matrix.html#a831a7bfc2725c17ea1f92018d38b59a7">remove_arc</a>(arc_ptr <span class="keyword">const</span>&amp; arc, node_const_ptr <span class="keyword">const</span>&amp; from, node_const_ptr <span class="keyword">const</span>&amp; to) noexcept</div><div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;    {</div><div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> from_index = node_dic_[from];</div><div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> to_index = node_dic_[to];</div><div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;        <span class="keywordflow">if</span>(from_index &gt;= matrix_.size() || to_index &gt;= matrix_[from_index].size()) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;</div><div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;        matrix_[from_index][to_index] = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;        endpoint_dic_.erase(arc);</div><div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;    }</div><div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;</div><div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;    stored_node_type stored_node_;</div><div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    node_dictionary_type node_dic_;</div><div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;    endpoint_dictionary_type endpoint_dic_;</div><div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;    adjacency_type matrix_;</div><div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;};</div><div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;</div><div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;} <span class="comment">// namespace bn</span></div><div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;</div><div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;<span class="preprocessor">#endif // BAYESIAN_NETWORKS_NETWORK_ADJACENCY_MATRIX_HPP</span></div><div class="ttc" id="namespacebn_html"><div class="ttname"><a href="namespacebn.html">bn</a></div><div class="ttdef"><b>Definition:</b> algorithm.hpp:16</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_ad4f5c3ee06fd608989ada1fb77a43b4d"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#ad4f5c3ee06fd608989ada1fb77a43b4d">bn::adjacency_matrix::target</a></div><div class="ttdeci">node_ptr target(arc_ptr const &amp;arc) const noexcept</div><div class="ttdoc">Obtain a target (child) node of an arc. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:273</div></div>
<div class="ttc" id="classbn_1_1component_1_1node_html"><div class="ttname"><a href="classbn_1_1component_1_1node.html">bn::component::node</a></div><div class="ttdoc">A class representing a node in network. </div><div class="ttdef"><b>Definition:</b> component.hpp:30</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_aa92bafa3f9c3b22d08dee2095042ef0c"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#aa92bafa3f9c3b22d08dee2095042ef0c">bn::adjacency_matrix::parent_nodes</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; parent_nodes(node_ptr const &amp;child) const</div><div class="ttdoc">Obtain a list of all nodes which are parent of the child (argument). </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:287</div></div>
<div class="ttc" id="traits_8hpp_html"><div class="ttname"><a href="traits_8hpp.html">traits.hpp</a></div><div class="ttdoc">Implementation of traits in bn::network. </div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_a3197b094434e85848f3bdee9bb740080"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#a3197b094434e85848f3bdee9bb740080">bn::adjacency_matrix::is_connect</a></div><div class="ttdeci">int is_connect(node_ptr const &amp;node, arc_ptr const &amp;arc) const noexcept</div><div class="ttdoc">Check whether a node and an arc are connected in the network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:242</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_abc28afe43d3613d68d12ef8130ddc46d"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#abc28afe43d3613d68d12ef8130ddc46d">bn::adjacency_matrix::add_arc</a></div><div class="ttdeci">arc_ptr add_arc(arc_ptr const &amp;arc, node_ptr const &amp;from, node_ptr const &amp;to)</div><div class="ttdoc">Register an arc into network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:167</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_ae1686c835506377c0965293cd5b9de8b"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#ae1686c835506377c0965293cd5b9de8b">bn::adjacency_matrix::operator=</a></div><div class="ttdeci">this_type &amp; operator=(this_type const &amp;rhs)</div><div class="ttdoc">(Copy operator=) Initialize nodes and arcs by copying a parameter. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:56</div></div>
<div class="ttc" id="component_8hpp_html"><div class="ttname"><a href="component_8hpp.html">component.hpp</a></div><div class="ttdoc">Implementations of important elements of bn::network. </div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_af3fe5bfab47465dadcb7e75811672e3d"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#af3fe5bfab47465dadcb7e75811672e3d">bn::adjacency_matrix::add_node</a></div><div class="ttdeci">node_ptr add_node(node_ptr const &amp;node)</div><div class="ttdoc">Register a node into network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:72</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_a2ff0a6c49658b14c4300b0ba7cc64ed4"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#a2ff0a6c49658b14c4300b0ba7cc64ed4">bn::adjacency_matrix::~adjacency_matrix</a></div><div class="ttdeci">virtual ~adjacency_matrix()=default</div><div class="ttdoc">(Default dtor) </div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_a7a0f7187014326001d03f733fe364c6a"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#a7a0f7187014326001d03f733fe364c6a">bn::adjacency_matrix::remove_arc</a></div><div class="ttdeci">bool remove_arc(node_ptr const &amp;from, node_ptr const &amp;to) noexcept</div><div class="ttdoc">Remove the argument arc from network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:205</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_a831a7bfc2725c17ea1f92018d38b59a7"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#a831a7bfc2725c17ea1f92018d38b59a7">bn::adjacency_matrix::remove_arc</a></div><div class="ttdeci">bool remove_arc(arc_ptr const &amp;arc) noexcept</div><div class="ttdoc">Remove the argument arc from network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:190</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_a35ec62aed27f33404ff2188728070f3c"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#a35ec62aed27f33404ff2188728070f3c">bn::adjacency_matrix::child_nodes</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; child_nodes(node_ptr const &amp;parent) const</div><div class="ttdoc">Obtain a list of all nodes which are child of the parent (argument). </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:311</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_a7e9b5530fa1be36f06d251e2117d543f"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#a7e9b5530fa1be36f06d251e2117d543f">bn::adjacency_matrix::adjacency_matrix</a></div><div class="ttdeci">adjacency_matrix()=default</div><div class="ttdoc">(Default ctor) Initialize nodes and arcs as empty. </div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_aeffc84b00aa2eb0ad233e6fa9dd0ca76"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#aeffc84b00aa2eb0ad233e6fa9dd0ca76">bn::adjacency_matrix::remove_node</a></div><div class="ttdeci">bool remove_node(node_ptr const &amp;node)</div><div class="ttdoc">Remove the argument node from network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:114</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_ae1067f195eaa0abc2ae0ff316d14d425"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#ae1067f195eaa0abc2ae0ff316d14d425">bn::adjacency_matrix::all_node</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; all_node() const</div><div class="ttdoc">Obtain all node pointers. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:330</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_afdeafe65325ba05e9ad1c7f72d7ca1ac"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#afdeafe65325ba05e9ad1c7f72d7ca1ac">bn::adjacency_matrix::is_adjacent</a></div><div class="ttdeci">arc_ptr is_adjacent(node_ptr const &amp;from, node_ptr const &amp;to) const</div><div class="ttdoc">Check whether two nodes are adjacent by a arc in the network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:224</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_a8663d697a4ebc12cec6f4a77dd5323bf"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#a8663d697a4ebc12cec6f4a77dd5323bf">bn::adjacency_matrix::all_arc</a></div><div class="ttdeci">std::vector&lt; arc_ptr &gt; all_arc() const</div><div class="ttdoc">Obtain all arc pointers. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:336</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html_ad398cf36e8f27e219dee05fe9429a0d2"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html#ad398cf36e8f27e219dee05fe9429a0d2">bn::adjacency_matrix::source</a></div><div class="ttdeci">node_ptr source(arc_ptr const &amp;arc) const noexcept</div><div class="ttdoc">Obtain a source (parent) node of an arc. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:259</div></div>
<div class="ttc" id="traits_8hpp_html_aa44fb0011435752a09a0f9b519f8d863"><div class="ttname"><a href="traits_8hpp.html#aa44fb0011435752a09a0f9b519f8d863">bn::traits::add_const_shared_t</a></div><div class="ttdeci">typename add_const_shared&lt; T &gt;::type add_const_shared_t</div><div class="ttdoc">Change shared_ptr&lt;T&gt; into shared_ptr&lt;const T&gt;. </div><div class="ttdef"><b>Definition:</b> traits.hpp:25</div></div>
<div class="ttc" id="classbn_1_1adjacency__matrix_html"><div class="ttname"><a href="classbn_1_1adjacency__matrix.html">bn::adjacency_matrix</a></div><div class="ttdoc">Implement class of adjacency matrix for bn::network. </div><div class="ttdef"><b>Definition:</b> adjacency_matrix.hpp:22</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
